<template>
  <div class="app-container">
    <!-- 筛选条件 -->
    <el-form
      v-show="showSearch"
      ref="queryForm"
      :model="queryParams"
      :inline="true"
      label-width="70px"
      label-position="left"
    >
      <el-form-item label="客户姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入客户姓名"
          clearable
        />
      </el-form-item>
      <el-form-item label="手机号码" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入手机号码"
          clearable
        />
      </el-form-item>
      <el-form-item label="用户城市" prop="city">
        <CityInput ref="CityInput" @selectCity="selectCity" />
      </el-form-item>
      <el-form-item label="芝麻分" prop="zhimaCredit">
        <el-select v-model="queryParams.zhimaCredit" placeholder="请选择芝麻分">
          <el-option label="无芝麻分" :value="0" />
          <el-option label="600分以下" :value="1" />
          <el-option label="600-650分" :value="2" />
          <el-option label="650-700分" :value="3" />
          <el-option label="700分以上" :value="4" />
        </el-select>
      </el-form-item>

      <el-form-item label="公积金" prop="fund">
        <el-select v-model="queryParams.fund" placeholder="请选择公积金">
          <el-option label="无" :value="0" />
          <el-option label="有" :value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="社保情况" prop="has">
        <el-select v-model="queryParams.has" placeholder="请选择社保情况">
          <el-option label="无" :value="0" />
          <el-option label="有" :value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="保险报单" prop="bdStatus">
        <el-select v-model="queryParams.bdStatus" placeholder="请选择保险报单">
          <el-option label="无" :value="0" />
          <el-option label="有" :value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="房产情况" prop="houseProperty">
        <el-select
          v-model="queryParams.houseProperty"
          placeholder="请选择房产情况"
        >
          <el-option label="无" :value="0" />
          <el-option label="有" :value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="车产情况" prop="carProperty">
        <el-select
          v-model="queryParams.carProperty"
          placeholder="请选择房产情况"
        >
          <el-option label="无" :value="0" />
          <el-option label="有" :value="1" />
        </el-select>
      </el-form-item>

      <el-form-item label="渠道来源" prop="channelName">
        <ChannelInput
          ref="ChannelInput"
          :channel-name="'D'"
          @selectChannel="selectChannel"
        />
      </el-form-item>

      <el-form-item label="创建时间" prop="endTime">
        <div class="r_flex">
          <el-date-picker
            v-model="queryParams.alltime"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['00:00:00', '23:59:59']"
            value-format="yyyy-MM-dd HH:mm:ss"
            format="yyyy-MM-dd HH:mm:ss"
            @change="changtime"
          />
        </div>
      </el-form-item>
    </el-form>

    <!-- 操作按钮 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <div class="table_border r_flex">
          <div
            v-for="(table, i) in tableData"
            :key="i"
            class="table_list r_transform1"
            :class="queryParams.applyNum === table.value ? 'tableActive' : ''"
            @click="changTable(table)"
          >
            <p>{{ table.name }}</p>
          </div>
        </div>
      </el-col>

      <!-- <el-col :span="1.5">
        <el-button v-hasPermi="['system:customer:add']" type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button icon="el-icon-refresh-left" size="mini" @click="getList"
          >刷新</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-printer"
          size="mini"
          @click="daochu"
          >客户列表</el-button
        >
      </el-col> -->
      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          :loading="btLoad"
          @click="butuiData"
          >补推</el-button
        >
      </el-col> -->

      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="butuiStatus = true"
          >一键推送</el-button
        >
      </el-col>

      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="oneClickMatching"
          >一键匹配</el-button
        >
      </el-col> -->

      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
      </el-col>

      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
    </el-row>

    <!-- 表格数据  fixed="left"-->
    <el-table
      v-if="refreshTable"
      v-loading="loading"
      :header-cell-style="{
        background: $store.state.app.theme.tableBack,
        color: $store.state.app.theme.tableColor,
      }"
      stripe
      border
      :data="businessList"
      @selection-change="handleSelectionChange"
      @cell-dblclick="celldblclick"
    >
      <el-table-column type="selection" align="center" />
      <el-table-column
        label="申请状态"
        sortable
        align="center"
        prop="applyNum"
        width="100px"
      >
        <template slot-scope="scope">
          <div
            class="r_cpter"
            :style="
              scope.row.applyNum == 0 ? 'color: #ff0000;' : 'color: #11b95c;'
            "
            @click="clickTable(scope.row)"
          >
            <i class="el-icon-position" />
            {{ scope.row.applyNum }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        label="客户姓名"
        width="110px"
        align="center"
        prop="name"
      >
        <template slot-scope="scope">
          <div
            style="color: #1890ff"
            class="r_cpter"
            @click="clickTable(scope.row)"
          >
            {{ scope.row.name }}
          </div>
        </template>
      </el-table-column>

      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="常住地" align="center" prop="city" />
      <el-table-column
        label="手机号码"
        width="140px"
        align="center"
        prop="name"
      >
        <template slot-scope="scope">
          {{ scope.row.phone }}
        </template>
      </el-table-column>
      <!-- <el-table-column label="性别" sortable align="center" width="140px" prop="zhimaCredit">
        <template slot-scope="scope">
          <div v-if="scope.row.zhimaCredit == 0">女</div>
          <div v-else-if="scope.row.zhimaCredit == 1">男</div>
        </template>
      </el-table-column> -->
      <el-table-column
        label="芝麻分"
        sortable
        align="center"
        width="140px"
        prop="zhimaCredit"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.zhimaCredit == 0">无芝麻分</div>
          <div v-else-if="scope.row.zhimaCredit == 1">600分以下</div>
          <div v-else-if="scope.row.zhimaCredit == 2">600-650分</div>
          <div v-else-if="scope.row.zhimaCredit == 3">650-700分</div>
          <div v-else-if="scope.row.zhimaCredit == 4">700分以上</div>
        </template>
      </el-table-column>
      <el-table-column
        label="职业"
        sortable
        align="center"
        width="140px"
        prop="job"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.job == 1">上班族</div>
          <div v-else-if="scope.row.job == 2">企业主</div>
          <div v-else-if="scope.row.job == 3">自由职业</div>
          <div v-else-if="scope.row.job == 4">公务员</div>
        </template>
      </el-table-column>

      <el-table-column
        label="信用情况"
        sortable
        align="center"
        width="140px"
        prop="creditHistory"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.creditHistory == 1">信用良好</div>
          <div v-else-if="scope.row.creditHistory == 2">逾期</div>
        </template>
      </el-table-column>

      <!-- <el-table-column
        label="征信信息"
        sortable
        align="center"
        width="140px"
        prop="peopleBankCredit"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.peopleBankCredit == 0">无人行征信</div>
          <div v-else-if="scope.row.peopleBankCredit == 1">征信良好</div>
          <div v-else-if="scope.row.peopleBankCredit == 2">
            有逾期，2年内60天以内
          </div>
          <div v-else-if="scope.row.peopleBankCredit == 3">
            有逾期，2年内60天以上
          </div>
          <div v-else-if="scope.row.peopleBankCredit == 4">
            有逾期，2年内90天以上
          </div>
        </template>
      </el-table-column>
      <el-table-column
        label="微粒贷"
        sortable
        align="center"
        width="140px"
        prop="microLoan"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.microLoan == 0">无微粒贷</div>
          <div v-else-if="scope.row.microLoan == 1">1~2千</div>
          <div v-else-if="scope.row.microLoan == 2">2~5千</div>
          <div v-else-if="scope.row.microLoan == 3">5千~1万</div>
          <div v-else-if="scope.row.microLoan == 4">1万以上</div>
        </template>
      </el-table-column>
      <el-table-column
        label="信用卡"
        sortable
        align="center"
        width="140px"
        prop="creditCard"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.creditCard == 0">无</div>
          <div v-else-if="scope.row.creditCard == 1">有</div>
        </template>
      </el-table-column>

      <el-table-column
        label="花呗"
        sortable
        align="center"
        width="140px"
        prop="huabei"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.huabei == 0">无花呗</div>
          <div v-if="scope.row.huabei == 1">3000以下</div>
          <div v-else-if="scope.row.huabei == 2">3000-10000</div>
          <div v-else-if="scope.row.huabei == 3">10000-30000</div>
          <div v-else-if="scope.row.huabei == 4">30000以上</div>
        </template>
      </el-table-column>
      <el-table-column
        label="京东白条"
        sortable
        align="center"
        width="140px"
        prop="baitiao"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.baitiao == 0">无京东白条</div>
          <div v-if="scope.row.baitiao == 1">3000以下</div>
          <div v-else-if="scope.row.baitiao == 2">3000-10000</div>
          <div v-else-if="scope.row.baitiao == 3">10000-30000</div>
          <div v-else-if="scope.row.baitiao == 4">30000以上</div>
        </template>
      </el-table-column> -->
      <el-table-column
        label="公积金"
        sortable
        align="center"
        width="100px"
        prop="fund"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.fund == 0"><el-tag type="info">无</el-tag></div>
          <div v-else-if="scope.row.fund == 1">
            <el-tag type="success">有</el-tag>
          </div>
          <div v-else>--</div>
        </template>
      </el-table-column>
      <el-table-column
        label="社保"
        sortable
        width="80px"
        align="center"
        prop="has"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.has == 0"><el-tag type="info">无</el-tag></div>
          <div v-else-if="scope.row.has == 1">
            <el-tag type="success">有</el-tag>
          </div>
          <div v-else>--</div>
        </template>
      </el-table-column>
      <!-- <el-table-column
        label="保险保单"
        sortable
        width="100px"
        align="center"
        prop="bdStatus"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.bdStatus == 0">
            <el-tag type="info">无</el-tag>
          </div>
          <div v-else-if="scope.row.bdStatus == 1">
            <el-tag type="success">有</el-tag>
          </div>
          <div v-else>--</div>
        </template>
      </el-table-column> -->
      <el-table-column
        label="房产情况"
        sortable
        width="100px"
        align="center"
        prop="houseProperty"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.houseProperty == 0">
            <el-tag type="info">无</el-tag>
          </div>
          <div v-else-if="scope.row.houseProperty == 1">
            <el-tag type="success">有</el-tag>
          </div>
          <div v-else>--</div>
        </template>
      </el-table-column>
      <el-table-column
        label="车产情况"
        sortable
        width="100px"
        align="center"
        prop="carProperty"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.carProperty == 0">
            <el-tag type="info">无</el-tag>
          </div>
          <div v-else-if="scope.row.carProperty == 1">
            <el-tag type="success">有</el-tag>
          </div>
          <div v-else>--</div>
        </template>
      </el-table-column>
      <el-table-column
        label="重要程度"
        sortable
        width="160px"
        align="center"
        prop="followStatus"
      >
        <template slot-scope="scope">
          <el-rate
            v-model="scope.row.followStatus"
            :colors="['#99A9BF', '#F7BA2A', '#FF9900']"
            @change="changWeih(scope.row)"
          />
        </template>
      </el-table-column>
      <el-table-column
        label="客户来源"
        width="180px"
        align="center"
        prop="channelName"
      />
      <el-table-column
        label="注册IP"
        align="center"
        prop="loginIp"
        width="160px"
      >
        <template slot-scope="scope">
          <div>{{ scope.row.loginIp }}</div>
        </template>
      </el-table-column>
      <el-table-column
        label="设备信息"
        align="center"
        prop="device"
        width="150px"
      />
      <el-table-column
        label="创建时间"
        sortable
        align="center"
        prop="createTime"
        width="160px"
      />
      <el-table-column
        v-if="checkPermi(['system:customer:edit', 'system:customer:remove'])"
        fixed="right"
        label="操作"
        width="320px"
        align="center"
      >
        <template slot-scope="scope">
          <!-- <el-button
            size="mini"
            type="text"
            @click="jumpRouter(scope.row, 'fasong')"
            >发送</el-button
          >
          <el-button
            v-hasPermi="['system:customer:edit']"
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            >修改</el-button
          > -->
          <el-button
            v-if="scope.row.parentId != 0"
            v-hasPermi="['system:customer:remove']"
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            >删除</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="jumpRouter(scope.row, 'maidian')"
            >埋点记录</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="jumpRouter(scope.row, 'dianji')"
            >极速贷点击记录</el-button
          >
          <!-- <el-button size="mini" type="text" @click="handleRadar(scope.row)"
            >雷达</el-button
          > -->
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-row :gutter="24" class="mb8" style="margin: 20px 0px">
      <el-col
        :span="24"
        style="display: flex; justify-content: flex-end; padding: 0px"
      >
        <el-pagination
          background
          layout="prev, pager, next, sizes, total"
          :page-sizes="[10, 50, 100, 200]"
          :page-size="queryParams.pageSize"
          :current-page.sync="queryParams.pageNum"
          :total="totalPage"
          @current-change="handlePageChange"
          @size-change="
            (newSize) => {
              queryParams.pageSize = newSize;
              getList();
            }
          "
        />
      </el-col>
    </el-row>

    <!-- 风控信息-详情  -->
    <DialogRadarArr
      :title="'报告详情'"
      ref="DialogRadar"
      :radarData="radarData"
      :radarArr="radarArr"
    ></DialogRadarArr>

    <!-- 对话框-修改 -->
    <el-dialog
      :title="titleDialog === 'add' ? '新增客户留资信息' : '修改客户留资信息'"
      :visible.sync="openDialog"
      width="1000px"
      append-to-body
    >
      <el-form
        ref="formDialog"
        style="padding: 0px 50px"
        label-position="right"
        :model="formDialog"
        :rules="rules"
        label-width="80px"
      >
        <div class="">
          <el-form-item label="客户姓名" prop="name">
            <el-input v-model="formDialog.name" disabled placeholder="请输入" />
          </el-form-item>
          <el-row>
            <el-col :span="12">
              <el-form-item label="芝麻分" prop="zhimaCredit">
                <el-select
                  v-model="formDialog.zhimaCredit"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无芝麻分" :value="0" />
                  <el-option label="600分以下" :value="1" />
                  <el-option label="600-650分" :value="2" />
                  <el-option label="650-700分" :value="3" />
                  <el-option label="700分以上" :value="4" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="公积金" prop="fund">
                <el-select
                  v-model="formDialog.fund"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无" :value="0" />
                  <el-option label="有" :value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="社保" prop="has">
                <el-select
                  v-model="formDialog.has"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无" :value="0" />
                  <el-option label="有" :value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="保险报单" prop="bdStatus">
                <el-select
                  v-model="formDialog.bdStatus"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无" :value="0" />
                  <el-option label="有" :value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="车产" prop="carProperty">
                <el-select
                  v-model="formDialog.carProperty"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无" :value="0" />
                  <el-option label="有" :value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="房产" prop="houseProperty">
                <el-select
                  v-model="formDialog.houseProperty"
                  placeholder="请选择"
                  style="width: 100%"
                >
                  <el-option label="无" :value="0" />
                  <el-option label="有" :value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="AB面切换" prop="platformType">
                <el-radio-group v-model="formDialog.platformType">
                  <el-radio :label="1">A面</el-radio>
                  <el-radio :label="2">B面</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="12" />
          </el-row>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :loading="submitLoad" @click="submitForm"
          >确 定</el-button
        >
        <el-button @click="openDialog = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog title="一键匹配" :visible.sync="quickMatchStatus">
      <div class="r_flex">
        <el-date-picker
          v-model="alltime"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
          value-format="yyyy-MM-dd HH:mm:ss"
          format="yyyy-MM-dd HH:mm:ss"
          @change="changtime2"
        />
      </div>
      <div style="display: flex; align-items: center; margin-top: 30px">
        <span>推送间隔(秒)</span>
        <el-input
          type="number"
          style="width: 200px;margin-left: 5px;"
          v-model="matchingInfo.seconds"
          placeholder="请输入推送间隔"
        />
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="quickMatchStatus = false">取 消</el-button>
        <el-button type="primary" @click.native="oneClickMatchingEvent"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="一键推送" :visible.sync="butuiStatus">
      <div>
          <el-radio-group v-model="configTypeTui">
            <el-radio
              class="yjts_box"
              v-for="dict in daedaiList"
              :key="dict.productId"
              :label="dict.productId"
            >{{ dict.name }}</el-radio>
          </el-radio-group>
      </div>

      <div style="width: 400px; margin-top: 20px;" >
        <el-tag type="success">成功数量：{{cgnumber}}</el-tag>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <el-tag type="danger">失败数量：{{sbnumber}}</el-tag>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="butuiStatus = false">取 消</el-button>
        <el-button type="primary" @click.native="butuiData"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <!-- 推送信息-详情 -->
    <el-dialog
      class="defaultDialog01"
      :title="'用户信息：'"
      :visible.sync="followDialog"
      width="1000px"
      append-to-body
    >
      <div class="follow_border">
        <el-descriptions class="margin-top" title="基本信息" :column="3" border>
          <template slot="extra">
            <!-- <el-button type="primary" size="small">操作</el-button> -->
          </template>
          <el-descriptions-item
            v-for="(followMsg, key) in followArr"
            :key="key"
          >
            <template slot="label">
              <i :class="followMsg.icon" />
              {{ followMsg.title }}
            </template>

            <div v-if="followMsg.key == 'weigh'">
              <el-rate
                v-model="followLogData[followMsg.key]"
                disabled
                :colors="['#99A9BF', '#F7BA2A', '#FF9900']"
              />
            </div>
            <div v-else-if="followMsg.key == 'zhimaCredit'">
              <div v-if="followLogData[followMsg.key] == 0">无芝麻分</div>
              <div v-else-if="followLogData[followMsg.key] == 1">600分以下</div>
              <div v-else-if="followLogData[followMsg.key] == 2">600-650分</div>
              <div v-else-if="followLogData[followMsg.key] == 3">650-700分</div>
              <div v-else-if="followLogData[followMsg.key] == 4">700分以上</div>
            </div>

            <div
              v-else-if="
                followMsg.key == 'fund' ||
                followMsg.key == 'has' ||
                followMsg.key == 'bdStatus' ||
                followMsg.key == 'houseProperty' ||
                followMsg.key == 'carProperty' ||
                followMsg.key == 'follow'
              "
            >
              <div v-if="followLogData[followMsg.key] == 0">无</div>
              <div v-else-if="followLogData[followMsg.key] == 1">有</div>
            </div>

            <div v-else-if="followMsg.key == 'phone'">
              <HiddenPhone :hiddenvalue="followLogData[followMsg.key]" />
            </div>

            <div v-else>
              {{ followLogData[followMsg.key] }}
            </div>
          </el-descriptions-item>
        </el-descriptions>

        <el-descriptions
          class="margin-top"
          title="推送信息"
          :column="3"
          border
          style="margin-top: 20px"
        >
          <template slot="extra">
            <!-- <el-button type="primary" size="small" @click="followMsgShow=!followMsgShow" >新增推送信息</el-button> -->
          </template>
        </el-descriptions>

        <div class="follow_new_data">
          <el-timeline>
            <!-- 新增推送信息 -->
            <el-timeline-item
              v-show="followMsgShow"
              timestamp="新增推送信息"
              placement="top"
              color="#0bbd87"
            >
              <el-card>
                <el-form
                  ref="followForm"
                  :model="followForm"
                  :rules="followRules"
                  label-width="110px"
                >
                  <!-- 推送信息 -->
                  <el-form-item label="跟进备注" prop="note">
                    <el-input
                      v-model="followForm.note"
                      type="textarea"
                      :rows="4"
                      placeholder="跟进备注"
                      maxlength="250"
                    />
                  </el-form-item>

                  <el-row :gutter="24">
                    <el-col :span="10">
                      <el-form-item
                        label="跟进状态"
                        prop="followStatus"
                        style="margin-bottom: 0px"
                      >
                        <el-select
                          v-model="followForm.followStatus"
                          placeholder="请选择状态"
                          style="width: 100%"
                        >
                          <el-option label="待跟进" :value="0" />
                          <el-option label="正在跟进" :value="1" />
                          <el-option label="准备办理" :value="2" />
                          <el-option label="正在办理" :value="3" />
                          <el-option label="已经办理" :value="4" />
                          <el-option label="暂时搁置" :value="5" />
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="11">
                      <el-form-item
                        label="下次跟进时间"
                        prop="nextTime"
                        style="margin-bottom: 0px"
                      >
                        <el-date-picker
                          v-model="followForm.nextTime"
                          style="width: 100%"
                          type="datetime"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          format="yyyy-MM-dd HH:mm:ss"
                          placeholder="选择日期时间"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="3">
                      <el-button
                        type="primary"
                        style="width: 100%"
                        @click="addFollowMsg()"
                        >确定</el-button
                      >
                    </el-col>
                  </el-row>
                </el-form>
              </el-card>
            </el-timeline-item>
            <!-- 跟进历史 -->
            <el-timeline-item
              v-for="(followMsg, key) in followNewData"
              :key="key"
              :timestamp="followMsg.createTime"
              placement="top"
            >
              <el-card>
                <el-descriptions title="">
                  <!-- <el-descriptions-item label="用户编号">{{followMsg.id}}</el-descriptions-item> -->

                  <el-descriptions-item label="用户姓名">{{
                    followMsg.name
                  }}</el-descriptions-item>
                  <el-descriptions-item label="甲方渠道">{{
                    followMsg.deptName
                  }}</el-descriptions-item>
                  <el-descriptions-item label="产品名称">{{
                    followMsg.productName
                  }}</el-descriptions-item>
                  <el-descriptions-item label="接单人员">{{
                    followMsg.userName
                  }}</el-descriptions-item>
                  <el-descriptions-item label="推送时间">{{
                    followMsg.createTime
                  }}</el-descriptions-item>
                  <el-descriptions-item label="推送结果">
                    <el-tag v-if="followMsg.pushStatus == 0" size="small"
                      >待跟进</el-tag
                    >
                    <el-tag
                      v-else-if="followMsg.pushStatus == 1"
                      size="small"
                      type="success"
                      >成功</el-tag
                    >
                    <el-tag
                      v-else-if="followMsg.pushStatus == 2"
                      size="small"
                      type="danger"
                      >失败</el-tag
                    >
                  </el-descriptions-item>
                  <el-descriptions-item label="推送方式">
                    <el-tag v-if="followMsg.type == 0" size="small"
                      >内部</el-tag
                    >
                    <el-tag
                      v-else-if="followMsg.type == 1"
                      size="small"
                      type="success"
                      >api</el-tag
                    >
                  </el-descriptions-item>

                  <el-descriptions-item label="推送详情">{{
                    followMsg.msg
                  }}</el-descriptions-item>
                </el-descriptions>
              </el-card>
            </el-timeline-item>
            <!-- 无更进历史 -->
            <p
              v-if="followNewData.length == 0"
              style="text-align: center; color: #a2a2a2; margin-bottom: 30px"
            >
              暂无推送记录
            </p>
          </el-timeline>
        </div>
      </div>
    </el-dialog>

    <!-- 埋点记录-弹窗 -->
    <el-dialog
      class="defaultDialog01"
      :title="'埋点记录'"
      :visible.sync="burialDialog"
      width="1000px"
      append-to-body
    >
      <!-- 表格数据 -->
      <!-- <el-table
        stripe
        border
        :data="burialArr"
        :header-cell-style="{background: $store.state.app.theme.tableBack,color: $store.state.app.theme.tableColor}"
        @cell-dblclick="celldblclick"
      >
        <el-table-column label="渠道id" align="center" prop="channelId" />
        <el-table-column label="客户id" align="center" prop="customerId" />
        <el-table-column label="埋点id" align="center" prop="eventId" />
        <el-table-column label="埋点名称" align="center" prop="eventName" :show-overflow-tooltip="true" />
        <el-table-column label="渠道码" align="center" prop="invite" />
        <el-table-column label="ip记录" align="center" prop="ip" width="120px;" />
        <el-table-column label="扩展字段" align="center" prop="jsonStr" width="200px;" :show-overflow-tooltip="true" />
        <el-table-column label="创建时间" align="center" prop="createTime" width="160px;" />
      </el-table> -->

      <div class="r_flex">
        <!-- <el-button
          type="primary"
          :loading="miniLoad"
          size="mini"
          @click="ppdedClick"
          >匹配大额贷</el-button
        > -->
        <el-tag
          v-for="(data, index) in ppdedArr"
          :key="index"
          style="transform: translate(0px, 0px); margin-left: 10px"
        >
          {{ data.name }}
        </el-tag>

        <!-- <el-tag v-if="ppdedArr.length == 0" :type="'danger'" style="transform: translate(0px, 0px); margin-left: 10px;" >没有产品</el-tag> -->
      </div>
      <el-descriptions
        v-if="burialArr[0]"
        class="margin-top"
        :title="`渠道码：${burialArr[0].invite}\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0客户ID：${burialArr[0].customerId}`"
        :column="3"
        border
        style="margin-top: 20px"
      />
      <!-- 跟进历史 -->
      <div class="yhgj">
        <el-timeline>
          <el-timeline-item
            v-for="(followMsg, key) in burialArr"
            :key="key"
            :timestamp="`${followMsg.ip}\xa0\xa0\xa0${followMsg.createTime}`"
            placement="top"
          >
            <el-card>
              <el-descriptions title="">
                <el-descriptions-item label="埋点名称">
                  <el-tag
                    :type="followMsg.eventId == 18 ? 'danger' : ''"
                    style="transform: translate(0px, -4px)"
                  >
                    {{ followMsg.eventName }}
                  </el-tag></el-descriptions-item
                >
                <!-- <el-descriptions-item label="渠道ID">{{followMsg.channelId}}</el-descriptions-item> -->
                <!-- <el-descriptions-item label="客户ID">{{followMsg.customerId}}</el-descriptions-item> -->
                <!-- <el-descriptions-item label="埋点ID">{{followMsg.eventId}}</el-descriptions-item> -->
                <!-- <el-descriptions-item label="渠道码">{{followMsg.invite}}</el-descriptions-item> -->
                <!-- <el-descriptions-item label="IP记录">{{followMsg.ip}}</el-descriptions-item> -->
                <el-descriptions-item label="记录数据">
                  <!-- 默认扩展字段 -->
                  <div v-if="followMsg.eventId == 18">
                    <div
                      v-if="
                        JSON.parse(followMsg.jsonStr).productName.length != 0
                      "
                    >
                      <el-tag
                        v-for="(data, index) in JSON.parse(followMsg.jsonStr)
                          .productName"
                        :key="index"
                        style="
                          transform: translate(0px, -4px);
                          margin-right: 10px;
                        "
                      >
                        {{ data }}
                      </el-tag>
                    </div>
                    <div v-else>
                      <el-tag
                        :type="'danger'"
                        style="transform: translate(0px, -4px)"
                      >
                        没有匹配到产品
                      </el-tag>
                    </div>
                  </div>

                  <div
                    v-else-if="
                      followMsg.eventId == 19 || followMsg.eventId == 14
                    "
                  >
                    <div v-if="JSON.parse(followMsg.jsonStr).productName">
                      <el-tag
                        style="
                          transform: translate(0px, -4px);
                          margin-right: 10px;
                        "
                      >
                        {{ JSON.parse(followMsg.jsonStr).productName }}
                      </el-tag>
                    </div>
                    <div v-else>
                      <el-tag
                        :type="'danger'"
                        style="transform: translate(0px, -4px)"
                      >
                        没有匹配到极速贷
                      </el-tag>
                    </div>
                  </div>

                  <div v-else>
                    <p v-show="followMsg.jsonStr">{{ followMsg.jsonStr }}</p>
                  </div>
                </el-descriptions-item>
              </el-descriptions>
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
    </el-dialog>

    <!-- 极速贷点击记录-弹窗 -->
    <el-dialog
      class="defaultDialog01"
      :title="'极速贷点击记录'"
      :visible.sync="clickjsDialog"
      width="1000px"
      append-to-body
    >
      <!-- 表格数据 -->
      <el-table
        stripe
        border
        :data="clickjsArr"
        :header-cell-style="{
          background: $store.state.app.theme.tableBack,
          color: $store.state.app.theme.tableColor,
        }"
        @cell-dblclick="celldblclick"
      >
        <!-- <el-table-column label="乙方渠道id" align="center" prop="channelId" /> -->
        <el-table-column
          label="乙方渠道名称"
          align="center"
          prop="channelName"
        />
        <el-table-column label="客户Id" align="center" prop="customerId" />
        <el-table-column label="姓名" align="center" prop="customerName" />
        <el-table-column label="极速贷产品id" align="center" prop="pid" />
        <!-- <el-table-column label="极速贷单价" align="center" prop="price" /> -->
        <el-table-column
          label="极速贷名称"
          align="center"
          prop="productName"
          width="150px"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="极速贷产品的链接"
          align="center"
          prop="productUrl"
          width="180px"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <div class="r_able_url">{{ scope.row.productUrl }}</div>
          </template>
        </el-table-column>
        <el-table-column
          label="创建时间"
          align="center"
          prop="createTime"
          width="160px"
        />
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  customerList,
  delCustomer,
  getCustomer,
  upCustomer,
  addCustomer,
  followList,
  applyList,
  addfollow,
  customerPush,
  matchProducts,
  getLdtz,
  quickMatch
} from "@/api/business/system";
import {
  eventRecordList,
  sendBusiness,
  geteventRecord,
  upeventRecord,
  addeventRecord,
  jisuProductRecordList,
} from "@/api/business/buriedPoint";
import { customerExport } from "@/api/system/user";
import { listProduct, delProduct, addProduct, updateProduct, check } from '@/api/product/product'

import { ossUpload } from "@/api/oss/oss";
import CityInput from "@/components/CityInput";
import { checkPermi } from "@/utils/permission"; // 权限判断函数
import HiddenPhone from "@/components/HiddenPhone";
import ChannelInput from "@/components/ChannelInput";
import DialogRadarArr from "@/components/DialogRadarArr";

export default {
  name: "ProductSell",
  components: { CityInput, HiddenPhone, ChannelInput, DialogRadarArr },
  data() {
    return {
      daedaiList: [],
      configTypeTui: '',
      // 遮罩层
      loading: true,
      quickMatchStatus: false,
      butuiStatus: false,
      alltime: [],
      miniLoad: false,
      ppdedArr: [],
      // 修改渠道loading
      submitLoad: false,
      // 显示搜索条件
      showSearch: false,
      // 表格树数据
      businessList: [],
      // 对话框类型
      titleDialog: "add",
      // 是否显示对话框
      openDialog: false,
      // 是否展开，默认全部展开
      isExpandAll: true,
      // 重新渲染表格状态
      refreshTable: true,
      cgnumber: 0,
      sbnumber: 0,
      // 查询参数
      queryParams: {
        pageNum: 1, // 当前页数
        pageSize: 10, // 分页大小
        name: "", // 渠道名
        idCard: "",
        age: "",
        zhimaCredit: "",
        phone: "",
        sex: "",
        fund: "",
        bdStatus: "",
        houseProperty: "",
        has: "",
        channelName: "",
        city: "",
        cityId: "",
        startTime: "",
        endTime: "",
        alltime: "",
        carProperty: "",
        platform: "",
        applyNum: "",
        // loanTerm: '',
      },
      // logo地址
      imageLogoUrl: "",
      imageLogoName: "",
      // 数据总条数
      totalPage: 0,
      // 是否显示推送信息对话框
      followDialog: false,
      // 用户名称
      followLogName: "",
      // 用户详情数据
      followLogData: {},
      // 是否新增
      followMsgShow: false,
      // 跟进内容
      followForm: {
        // 下次跟进时间
        nextTime: "",
        // 跟进备注
        note: "",
        // 跟进状态：0待跟进 1正在跟进 2准备办理 3正在办理 4已经办理 5暂时搁置
        followStatus: "",
      },
      // 跟进记录列表
      followNewData: [],
      // 用户数据端
      followArr: [
        { title: "用户姓名", key: "name", icon: "el-icon-phone-user" },
        { title: "手机号码", key: "phone", icon: "el-icon-phone-outline" },
        { title: "客户编号", key: "id", icon: "el-icon-user" },
        { title: "创建时间", key: "createTime", icon: "el-icon-date" },
        { title: "年龄", key: "age", icon: "el-icon-user" },
        { title: "常住地", key: "city", icon: "el-icon-map-location" },
        // { title: '客户状态', key: 'zhimaCredit', icon: 'el-icon-user' },
        // { title: '重要程度', key: 'weigh', icon: 'el-icon-star-off' },
        // { title: '申请金额', key: 'loan', icon: 'el-icon-money' },
        // { title: '贷款期限', key: 'loanTerm', icon: 'el-icon-date' },
        {
          title: "芝麻分",
          key: "zhimaCredit",
          icon: "el-icon-document-checked",
        },
        { title: "公积金", key: "fund", icon: "el-icon-document-checked" },
        { title: "社保", key: "has", icon: "el-icon-document-checked" },
        {
          title: "保险保单",
          key: "bdStatus",
          icon: "el-icon-document-checked",
        },
        {
          title: "名下房产",
          key: "houseProperty",
          icon: "el-icon-document-checked",
        },
        {
          title: "名下车产",
          key: "carProperty",
          icon: "el-icon-document-checked",
        },
        // { title: '跟进状态', key: 'follow', icon: 'el-icon-bell' },
        // { title: '最后跟进时间', key: 'updateTime', icon: 'el-icon-date' },
        { title: "渠道来源", key: "channelName", icon: "el-icon-monitor" },
      ],

      // 埋点记录
      burialDialog: false,
      burialArr: [],
      // 点击记录
      clickjsDialog: false,
      clickjsArr: [],
      // 新增、修改参数
      formDialog: {
        age: "",
        bdStatus: 0,
        carProperty: 0,
        channelName: "",
        cid: 0,
        createBy: "",
        createTime: "",
        creditHistory: 0,
        finish: 0,
        fund: 0,
        has: 0,
        houseProperty: 0,
        idCard: "",
        invite: "",
        loginIp: "",
        name: "",
        phone: "",
        searchValue: "",
        sex: "",
        updateBy: "",
        updateTime: "",
        zhimaCredit: 0,
      },
      butuiArr: [],
      btLoad: false,
      // 标签页筛选
      tableData: [
        { name: "全部", value: "" },
        { name: "已申请", value: 1 },
        { name: "未申请", value: 0 },
      ],
      // 新增表单校验
      rules: {
        // name: [{ required: true, message: '该项不能为空', trigger: 'blur' }],
        idCard: [{ required: true, message: "该项不能为空", trigger: "blur" }],
      },
      // 新增表单校验
      followRules: {
        note: [{ required: true, message: "该项不能为空", trigger: "blur" }],
        nextTime: [
          { required: true, message: "该项不能为空", trigger: "blur" },
        ],
        followStatus: [
          { required: true, message: "该项不能为空", trigger: "blur" },
        ],
      },
      // 风控
      radarData: {},
      matchingInfo: {
        seconds: 30,
        startTime: "",
        endTime: "",
      },
      // 风控
      radarArr: [
        [
          { title: "用户姓名", key: "name", icon: "" },
          { title: "申请准入分11", key: "A22160001", icon: "" },
          { title: "申请准入置信度", key: "A22160002", icon: "" },
          { title: "申请命中机构数", key: "A22160003", icon: "" },
          { title: "申请命中消金类机构数", key: "A22160004", icon: "" },
          { title: "申请命中网络贷款类机构数", key: "A22160005", icon: "" },
          { title: "机构总查询次数", key: "A22160006", icon: "" },
          { title: "最近一次查询时间", key: "A22160007", icon: "" },
          { title: "近1个月机构总查询笔数", key: "A22160008", icon: "" },
          { title: "近3个月机构总查询笔数", key: "A22160009", icon: "" },
          { title: "近6个月机构总查询笔数", key: "A22160010", icon: "" },
          { title: "在网时长范围起始值(单位/月)", key: "onlineTime", icon: "" },
          {
            title: "归属运营商:(1-移动:2-联通:3-电信)",
            key: "phoneType",
            icon: "",
          },
          { title: "操作网络", key: "operator", icon: "" },
          { title: "探查结果编码", key: "result_code", icon: "" },
          // { title: '最大逾期金额', key: 'max_overdue_amt', icon: '' },
          // { title: '最长逾期天数', key: 'max_overdue_days', icon: '' },
          // { title: '最近逾期时间', key: 'max_overdue_time', icon: '' },
          { title: "当前逾期机构数", key: "currently_overdue", icon: "" },
          { title: "当前履约机构数", key: "currently_performance", icon: "" },
          { title: "异常还款机构数", key: "acc_exc", icon: "" },
          { title: "睡眠机构数", key: "acc_sleep", icon: "" },
        ],
        [
          { title: "贷款行为分", key: "B22170001", icon: "" },
          { title: "最近一次贷款放款时间", key: "B22170054", icon: "" },
          { title: "最近一次履约距今天数", key: "B22170050", icon: "" },
          { title: "正常还款订单比例", key: "B22170034", icon: "" },
          { title: "信用贷款时长", key: "B22170053", icon: "" },
          { title: "贷款已结清订单数", key: "B22170052", icon: "" },
        ],
        [
          { title: "近6个月M0+逾期贷款笔数", key: "B22170025", icon: "" },
          { title: "近6个月M1+逾期贷款笔数", key: "B22170028", icon: "" },
          { title: "近6个月累计逾期金额", key: "B22170031", icon: "" },
          { title: "近12个月M0+逾期贷款笔数", key: "B22170026", icon: "" },
          { title: "近12个月M1+逾期贷款笔数", key: "B22170029", icon: "" },
          { title: "近12个月累计逾期金额", key: "B22170032", icon: "" },
          { title: "近24个月M0+逾期贷款笔数", key: "B22170027", icon: "" },
          { title: "近24个月M1+逾期贷款笔数", key: "B22170030", icon: "" },
          { title: "近24个月累计逾期金额", key: "B22170033", icon: "" },
        ],
        [
          { title: "网贷授信额度", key: "C22180001", icon: "" },
          { title: "网贷额度置信度", key: "C22180002", icon: "" },
          { title: "网络贷款类机构数", key: "C22180003", icon: "" },
          { title: "网络贷款类产品数", key: "C22180004", icon: "" },
          { title: "网络贷款机构最大授信额度", key: "C22180005", icon: "" },
          { title: "网络贷款机构平均授信额度", key: "C22180006", icon: "" },
          { title: "消金贷款类机构数", key: "C22180007", icon: "" },
          { title: "消金贷款类产品数", key: "C22180008", icon: "" },
          { title: "消金贷款类机构最大授信额度", key: "C22180009", icon: "" },
          { title: "消金贷款类机构平均授信额度", key: "C22180010", icon: "" },
          { title: "消金建议授信额度", key: "C22180011", icon: "" },
          { title: "消金额度置信度", key: "C22180012", icon: "" },
        ],
      ],
    };
  },
  created() {
    // 初始化时间
    // this.$set(this.queryParams, 'alltime', [this.$store.state.app.theme.startTime, this.$store.state.app.theme.endTime])
    // this.$set(this.queryParams, 'startTime', this.$store.state.app.theme.startTime)
    // this.$set(this.queryParams, 'endTime', this.$store.state.app.theme.endTime)
    this.$forceUpdate();
    // 分页数据
    this.getList();
    this.getListlistProduct()
  },
  methods: {
    checkPermi,
    oneClickMatching() {
      this.matchingInfo.seconds = 30;
      this.alltime = [];
      this.matchingInfo.startTime = '';
      this.matchingInfo.endTime = '';
      this.quickMatchStatus = true;
    },
    // 时间选择
    changtime(newtime) {
      this.queryParams.startTime = newtime ? newtime[0] : "";
      this.queryParams.endTime = newtime ? newtime[1] : "";
    },
    changtime2(newtime) {
      this.matchingInfo.startTime = newtime ? newtime[0] : "";
      this.matchingInfo.endTime = newtime ? newtime[1] : "";
    },
    oneClickMatchingEvent() {
      if (this.matchingInfo.seconds < 3) {
        this.$message.error("推送间隔必须大于3");
        return;
      }
      if (!this.matchingInfo.startTime || !this.matchingInfo.endTime) {
        this.$message.error("请选择时间");
        return;
      }
      quickMatch(this.matchingInfo)
        .then(() => {
          this.quickMatchStatus = false;
          this.getList();
          this.$modal.msgSuccess("一键匹配成功");
        })
        .catch(() => {
          this.getList();
        });
    },
    // 风控
    handleRadar(row) {
      this.loading = true;
      getLdtz(row.id)
        .then((res) => {
          console.log(res.data, "res.data");
          if (res.data.code) {
            this.$message.error(res.data.msg);
          } else {
            const newData = { ...res.data.ld, ...res.data.tz, ...res.data.sc };
            console.log(newData, "newData");
            this.radarData = newData;
            this.radarData.apply_report_detail = {
              ...newData.apply_report_detail,
              ...res.data.tz,
              ...res.data.sc,
            };
            this.radarData.apply_report_detail.name = row.name;

            this.$refs.DialogRadar.visibleKey = true;
          }
          this.loading = false;
        })
        .catch((err) => {
          this.loading = false;
        });
    },
    changWeih(row) {
      // 点击星级修改权重
      const newweigh = {
        id: row.id,
        followStatus: row.followStatus
      }

      upCustomer(newweigh)
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("重要程度变更成功");
        })
        .catch(() => {
          this.getList();
        });
    },
    butuiData() {
      console.log(this.butuiArr.length, this.configTypeTui, 'this.butuiArr')
      if (this.butuiArr.length !== 0) {
        this.btLoad = true;
        customerPush({ ids: this.butuiArr, productId: this.configTypeTui })
          .then((res) => {
            this.$message.warning("执行完毕！");
            this.btLoad = false;

            this.cgnumber = res.data.successNum
            this.sbnumber = res.data.errorNum
          })
          .catch(() => {
            this.btLoad = false;
            this.cgnumber = 0
            this.sbnumber = 0
          });
      } else {
        this.$message.error("请勾选补推数据");
      }
    },
    async daochu() {
      const response = await customerExport({pageNum: 1, pageSize: 999});
      // console.log(response, 'response')
      let blobUrl = window.URL.createObjectURL(response);
      const a = document.createElement("a");
      a.download = "客户列表";
      a.href = blobUrl;
      a.click();
    },
    ppdedClick() {
      this.miniLoad = true;
      matchProducts(this.burialArr[0].customerId)
        .then((res) => {
          this.ppdedArr = res.data;
          this.miniLoad = false;
          if (this.ppdedArr.length == 0) {
            this.$message.error("匹配没有产品");
          }
        })
        .catch((err) => {
          this.miniLoad = false;
        });
    },
    handleSelectionChange(val) {
      this.butuiArr = val.map((res) => res.id);
    },
    // table筛选
    changTable(table) {
      this.queryParams.applyNum = table.value;
      this.getList();
    },
    // 双击复制
    celldblclick(row, column, cell, event) {
      if (!column.property) return;
      if (!row[column.property]) return;
      const oInput = document.createElement("input");
      oInput.value = row[column.property];
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      this.$message.success({
        message: "复制成功",
        showClose: true,
      });
      oInput.remove();
    },
    // 选择渠道
    selectChannel(data) {
      this.$set(this.queryParams, "channelName", data.name);
    },
    // 新增推送信息
    addFollowMsg() {
      this.$refs["followForm"].validate((valid) => {
        if (valid) {
          const parm = this.followForm;
          parm.customerId = this.followLogData.uid;
          parm.applyId = this.followLogData.id;
          addfollow(this.followForm)
            .then((response) => {
              // const newweigh = {
              //   id: this.followLogData.id,
              //   follow: this.followForm.followStatus
              // }
              // upApplysUser(newweigh).then(res=>{
              // })
              this.$modal.msgSuccess("新增成功");
              this.resetForm("followForm");
              this.followList();
              this.getList();
            })
            .finally(() => {});
        }
      });
    },
    // 点击表格
    clickTable(row) {
      this.followLogData = row;
      // console.log(this.followLogData, 'this.followLogData')
      this.followLogName = row.name;
      this.followDialog = true;
      this.followList();
    },
    // 更新跟进列表
    followList() {
      applyList({ uid: this.followLogData.id }).then((res) => {
        this.followNewData = res.rows;
      });
    },
    // 电话号码隐藏
    netTel(tel) {
      var reg = /^(\d{3})\d{4}(\d{4})$/;
      return tel.replace(reg, "$1****$2");
    },
    // 跳转数据统计
    jumpRouter(data, type) {
      this.ppdedArr = [];
      if (type === "maidian") {
        this.burialDialog = true;
        eventRecordList({
          customerId: data.id,
          pageNum: 1,
          pageSize: 999,
        }).then((response) => {
          this.burialArr = response.rows;
        });
      } else if (type === "dianji") {
        this.clickjsDialog = true;
        jisuProductRecordList({ customerId: data.id }).then((response) => {
          this.clickjsArr = response.rows;
        });
        // this.$router.push({ path: "/dataControl/buriedPointJisu", query: { id: data.id } });
      } else if (type == "fasong") {
        sendBusiness(data.id).then((response) => {
          this.$modal.msgSuccess("发送成功");
        });
        // this.$router.push({ path: "/dataControl/buriedPointJisu", query: { id: data.id } });
      }

      // if (type == 'maidian') {
      //   this.$router.push({ path: "/dataControl/buriedPointRecord", query: { id: data.id } });
      // } else if (type == 'dianji') {
      //   this.$router.push({ path: "/dataControl/buriedPointJisu", query: { id: data.id } });
      // }
    },
    // 城市选择
    selectCity(data) {
      this.queryParams.city = data.map((value) => value.cname).join();
      this.queryParams.cityId = data.map((value) => value.ccode).join();
    },
    // 时间选择
    changtime(newtime) {
      this.queryParams.startTime = newtime ? newtime[0] : "";
      this.queryParams.endTime = newtime ? newtime[1] : "";
    },
    // 钩子
    requestUpload(param) {},
    // 上传预处理
    beforeAvatarUpload(file) {
      if (file.type.indexOf("image/") === -1) {
        this.$modal.msgError(
          "文件格式错误，请上传图片类型,如:JPG,PNG后缀的文件。"
        );
      } else {
        const reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => {
          this.imageLogoUrl = reader.result;
          this.imageLogoName = file;
        };
        this.uploadImg(file);
      }
    },
    /** 查询产品列表 */
    getListlistProduct() {
      listProduct({pageNum: 1,pageSize: 999}).then(response => {
        this.daedaiList = [...response.rows]
      })
    },
    // 上传图片
    uploadImg(file) {
      const formData = new FormData();
      formData.append("file", file);
      ossUpload(formData).then((response) => {
        this.imageLogoUrl = response.data.url;
        this.$modal.msgSuccess("logo上传成功");
      });
      // let dvObj = document.createElement('input');
      // dvObj.type = 'file';
      // dvObj.id = 'inputUpLoad';
      // // 添加input
      // document.body.appendChild(dvObj);
      // // 删除input
      // document.body.removeChild(dvObj)
      // let files = document.getElementById("inputUpLoad").files //获取文件列表
      // files.value = this.imageLogoUrl;
      // let formData = new FormData();
      // formData.append("file", files[0], this.imageLogoName);
      // ossUpload(formData).then(response => {
      //   this.imageLogoUrl = response.data.imgUrl;
      //   this.$modal.msgSuccess("上传成功");
      // });
    },
    // 查询列表
    getList() {
      this.loading = true;
      customerList(this.queryParams)
        .then((response) => {
          this.businessList = response.rows;
          this.totalPage = response.total;
          this.loading = false;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 新增按钮操作
    handleAdd() {
      if (this.formDialog.id) {
        this.formDialog = this.$options.data().formDialog;
      }
      this.openDialog = true;
      this.titleDialog = "add";
    },
    // 搜索按钮操作
    handleQuery() {
      this.getList();
    },
    // 重置按钮操作
    resetQuery() {
      this.$refs.CityInput.cityKey = "";
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 删除按钮操作
    handleDelete(row) {
      this.$modal
        .confirm('是否确认删除名称为"' + row.name + '"的数据项？')
        .then(function () {
          return delCustomer(row.id);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    // 修改按钮操作
    handleUpdate(row) {
      this.loading = true;
      const upId = row.id;
      getCustomer(upId)
        .then((response) => {
          this.loading = false;
          this.openDialog = true;
          this.titleDialog = "up";
          this.formDialog = response.data;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 修改按钮操作
    submitForm() {
      this.$refs["formDialog"].validate((valid) => {
        if (valid) {
          this.submitLoad = true;
          if (this.titleDialog === "add") {
            addCustomer(this.formDialog)
              .then(() => {
                this.submitLoad = false;
                this.openDialog = false;
                this.getList();
                this.$modal.msgSuccess("新增成功");
              })
              .catch(() => {
                this.submitLoad = false;
              });
          } else {
            upCustomer(this.formDialog)
              .then(() => {
                this.submitLoad = false;
                this.openDialog = false;
                this.getList();
                this.$modal.msgSuccess("修改成功");
              })
              .catch(() => {
                this.submitLoad = false;
              });
          }
        }
      });
    },
    // 表单重置
    reset() {
      this.form = {
        parentId: "",
        deptName: "",
        pdAmount: "",
        tag: "",
        leader: "",
        type: "",
        url: "",
        zkStatus: "1",
      };
      this.resetForm("form");
    },
    // 分页请求
    handlePageChange(data) {
      this.queryParams.pageNum = data;
      this.getList();
    },
    // 双击复制
    celldblclick(row, column, cell, event) {
      if (!column.property) return;
      if (!row[column.property]) return;
      const oInput = document.createElement("input");
      oInput.value = row[column.property];
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      this.$message.success({
        message: "复制成功",
        showClose: true,
      });
      oInput.remove();
    },
  },
};
</script>
<style lang='scss'>
.el-table--border {
  position: relative !important;
}
.yhgj .el-card__body {
  padding-bottom: 4px;
}
.yjts_box{
  min-width: 120px;
  min-height: 30px;
}
</style>
